package cn.onlineoedering.util;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder;

public class HibernateUtil {
		public static Session getSession(){
			Configuration configuration=new Configuration().configure();
			ServiceRegistry resgistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry();
			 SessionFactory sessionFactory=configuration.buildSessionFactory(resgistry);
			Session session = sessionFactory.openSession();
			return session;
		}
}
